package com.tanhua.server.controller;

import com.tanhua.model.vo.SoundVo;
import com.tanhua.server.service.PeachblossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * 桃花传音
 * @author youshengfeng
 * @date 2022/2/20 上午 10:53
 */
@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {
    @Autowired
    private PeachblossomService peachblossomService;

    /**
     *发送语音
     * @return
     */
    @PostMapping
    public void SendVoices( MultipartFile soundFile){
        peachblossomService.addVoice(soundFile);
    }

    /**
     *接收语音
     * @return
     */
    @GetMapping
    public ResponseEntity<SoundVo> receptionVoices(){
        SoundVo soundVo=peachblossomService.receptionVoices();
        return ResponseEntity.ok(soundVo);
    }
}
